import { BaseWindow } from "../../../../component/window/BaseWindow";
import { ObjCreate } from "../../common/ObjCreate";
import { Language } from "../../../../../extend/language/Language";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../resource/ImagesConst";
import { BaseItem } from "../../common/BaseItem";
import { ItemData } from "../../../resource/info/ItemData";
import { PopupManager } from "../../../manager/PopupManager";
import { EItemUpdateOper } from "../../../../../Message/Game/EItemUpdateOper";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { ColorConfig } from "../../../resource/ColorConfig";
import { GameDefConfig } from "../../../resource/GameDefConfig";
import { GButton } from "../../../../../com/mui/controls/GButton";
type int = number;
//class AdvanceResultPanel
    
    export  class AdvanceResultPanel extends BaseWindow
    {
        constructor()
        {
            super();
            setSize(280, 180);
            title = ObjCreate.createTitleTextField(Language.getString(60292));
            titleHeight = 28;
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            ObjCreate.createBg(16, 38, 248, 132, this);
            this._text = ObjCreate.createTextField("", 20, 45, 250, 50, this);
            this._text.wordWrap = true;
            this._baseBg = GlobalClass.getBitmap(ImagesConst.equipment_boarder);
            this._baseBg.x = 115;
            this._baseBg.y = 75;
            this.addChild(this._baseBg);
            this._baseItem = new BaseItem();
            this._baseItem.toolTipType = ItemData.ToolTipType_Forge;
            this._baseItem.setSize(32, 32);
            this._baseItem.isDragAble = false;
            this._baseItem.isDropAble = false;
            this._baseItem.isThrowAble = false;
            this._baseItem.isShowLock = true;
            this._baseItem.x = this._baseBg.x + 8;
            this._baseItem.y = this._baseBg.y + 8;
            addChild(this._baseItem);
            this._OKbtn = ObjCreate.createGButton(Language.getString(69901), 115, 136, 50, 26, this, "ButtonSpecial");
            this._OKbtn.addEventListener(flash.events.MouseEvent.CLICK, this.onOKButtonClick);
            return;
        }

        protected /* override */ createDisposedChildrenImpl(): void
        {
            super.createDisposedChildrenImpl();
            if (closeBtn) 
            {
                closeBtn.visible = false;
            }
            return;
        }

        /* internal  */onOKButtonClick(arg1: Object /* flash.events.MouseEvent */): void
        {
            PopupManager.removePopup(this);
            this._baseBg = null;
            this._baseItem = null;
            return;
        }

        public setResultItem(arg1: ItemData, arg2: int): void
        {
            this._baseItem.itemData = arg1;
            if (arg2 == EItemUpdateOper._EItemUpdateOperAdvance || arg2 == EItemUpdateOper._EItemUpdateOperAdvanceColor || arg2 == EItemUpdateOper._EItemUpdateOperPetEquipAdvance) 
            {
                this._text.htmlText = "  " + Language.getString(60293) + "\n" + "  " + HTMLUtil.addColor(arg1.name, ColorConfig.instance.getItemColor(arg1.itemInfo.item.color).color) + "！";
            }
            else if (arg2 == EItemUpdateOper._EItemUpdateUpdradePrefix || arg2 == EItemUpdateOper._EItemUpdatePetEquipUpgradePrefix) 
            {
                this._text.htmlText = "  " + Language.getString(60294) + "\n" + "  " + HTMLUtil.addColor(GameDefConfig.instance.getEPrefixx(arg1.itemExInfo.prefix, arg1.type).name + Language.getString(60295) + arg1.name, ColorConfig.instance.getItemColor(arg1.itemInfo.item.color).color) + "！";
            }
            return;
        }

        /* internal */ /* var */_text: Object /* flash.text.TextField */;

        /* internal */ /* var */_OKbtn: GButton;

        /* internal */ /* var */_baseBg: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_baseItem: BaseItem;
    }
